<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <ul>

  </ul>
  <script>
    const data = [
      { name: '杰哥', age: 16 },
      { name: '浪哥', age: 18 },
    ]
    // const li = document.createElement('li')
    const newStr = data.map(item => `
    <li>
      <span style="color:red">姓名：${item.name}</span>
      <span>年龄：${item.age}</span>
    </li>
    `).join('')
    document.querySelector('ul').innerHTML = newStr
    // document.querySelector('ul').appendChild(newStr)
  </script>
</body>

</html>